package middle;

public class Solution_343 {
    public int integerBreak(int n) {
        int[] arrays = new int[n+1];
        // arrays[i] 表示数字i可拆成k个整数相乘的最大值
        for (int i = 1; i <= n; i++) {
            int num = 1;
            for (int j = 1; j < i; j++) {
                num = Math.max(num, Math.max(arrays[i - j] * j, (i - j) * j));
            }
            arrays[i] = num;
        }
        return arrays[n];
    }

    public static void main(String[] args) {
        Solution_343 model = new Solution_343();
        System.out.println(model.integerBreak(2));
        System.out.println(model.integerBreak(10));
    }
}
